{template '_header'}
<div class='page-header'><span>当前位置：<span class="text-primary">满额包邮设置</span></span></div>
 
   <div class="page-content">
       <form id="dataform"    {ifp 'sale.enoughfree'}action="" method="post"{/if} class="form-horizontal form-validate">


       <div class="panel" >
           <div class="panel-body">
               <div class="col-sm-9 col-xs-12">
                   <h4 class="set_title">满额包邮</h4>
                   <span> 开启满包邮, 订单总金额超过多少可以包邮</span>
               </div>
               <div class="col-lg pull-right" style="padding-top:10px;text-align: right" >
                   {ifp 'sale.enoughfree'}
                   <input type="checkbox" class="js-switch" name="data[enoughfree]" value="1" {if $data['enoughfree']==1}checked{/if} />
                   {else}
                   {if $data['enoughfree']==1}
                   <span class='text-success'>开启</span>
                   {else}
                   <span class='text-default'>关闭</span>
                   {/if}
                   {/if}
               </div>
           </div>

           <div id='enoughfree'  {if empty($data['enoughfree'])}style="display:none"{/if}>
           <div class="form-group">
               <label class="col-lg control-label">单笔订单满</label>
               <div class="col-sm-9 col-xs-12">
                   {ifp 'sale.enoughfree'}
                   <div class='input-group fixsingle-input-group'>
                       <input type="text" name="data[enoughorder]"  value="{$data['enoughorder']}" class="form-control" />
                       <span class='input-group-addon'>元</span>
                   </div>
                   <span class='help-block'>如果开启满额包邮，设置0为全场包邮</span>
                   {else}
                   <div class='form-control-static'>{if empty($data['enoughmoney'])}全场包邮{else}订单金额满{$data['enoughmoney']}元包邮{/if}</div>
                   {/if}
               </div>
           </div>


           <div class="form-group">
               <label class="col-lg control-label">不参加的地区</label>
               <div class="col-sm-9 col-xs-12">
                   {ifp 'sale.enoughfree'}
                   <div id="areas" class="form-control-static">{$data['enoughareas']}</div>
                   <a href="javascript:;" class="btn btn-default" onclick="selectAreas()">选择地区</a>
                   <input type="hidden" id='selectedareas' name="data[enoughareas]" value="{$data['enoughareas']}" />
                   <input type="hidden" id='selectedareas_code' name="data[enoughareas_code]" value="{$data['enoughareas_code']}" />
                   {else}
                   <div class='form-control-static'>{$data['enoughareas']}</div>
                   {/if}
               </div>
           </div>

           <div class="form-group">
               <label class="col-lg control-label">不参与包邮的商品</label>
               <div class="col-sm-9">
                   <div class="form-group" style="height: auto; display: block;">
                       <div class="col-sm-12 col-xs-12">
                           {ifp 'sale.enoughfree'}
                           <?php echo tpl_selector('goodsids',array('preview'=>true,'readonly'=>true, 'multi'=>1,'url'=>webUrl('goods/query'),'items'=>$goods,'buttontext'=>'选择商品','placeholder'=>'请选择商品'))?>
                           {else}
                           <div class="input-group multi-img-details container ui-sortable" >
                               {loop $goods $item}
                               <div data-name="goodsid" data-id="{$item['id']}" class="multi-item">
                                   <img src="{php echo tomedia($item['thumb'])}" class="img-responsive img-thumbnail">
                                   <div class="img-nickname">{$item['title']}</div>
                               </div>
                               {/loop}
                           </div>
                           {/if}
                       </div>
                   </div>

               </div>
           </div>
       </div>
   </div>

{ifp 'sale.enoughfree'}
<div class="form-group"></div>
<div class="form-group">

    <div class="col-sm-9 col-xs-12">
        <input type="submit"  value="保存设置" class="btn btn-primary"/>

    </div>
</div>
{/if}


</form>
   </div>
 
<script language='javascript'>
  
                $(function () {
                    $(":checkbox[name='data[enoughfree]']").click(function () {
                        if ($(this).prop('checked')) {
                            $("#enoughfree").show();
                        }
                        else {
                            $("#enoughfree").hide();
                        }
                    })
                   

                })
         
             
	</script>

{if empty($new_area)}
{template 'shop/selectareas'}
{else}
{template 'shop/selectareasNew'}
{/if}

{template '_footer'}
